import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { LoginGuard } from './services/login.guard';
import { IndexComponent } from './components/index/index.component';
import { EditorComponent } from './components/editor/editor.component';
import { LoginComponent } from './components/login/login.component';
import { SecurityComponent } from './components/security/security.component';

const routes: Routes = [
  {
    path: '',
    component: IndexComponent
  },
  {
    path: 'discover',
    loadChildren: () => import('./components/discover/discover.module').then(mod => mod.DiscoverModule)
  },
  {
    path: 'login',
    component: LoginComponent
  },
  {
    path: 'editor',
    component: EditorComponent,
    canActivate: [LoginGuard]
  },
  {
    path: 'security',
    component: SecurityComponent
  },
  {
    path: 'personal/:id',
    loadChildren: () => import('./components/personal/personal.module').then(mod => mod.PersonalModule)
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
